﻿using AutoMapper;
using MediaAdmin.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MediaAdmin.Application.Infrastructure
{
    public class CommonMapper : IMapper
    {
        static CommonMapper()
        {
            AssetController.Mappings.GetMap();
            JobController.Mappings.GetMap();

            AutoMapper.Mapper.AssertConfigurationIsValid();
        }

        public object Map(object source, Type sourceType, Type destinationType)
        {
            return Mapper.Map(source, sourceType, destinationType);
        }


        public TDestination Map<TSource, TDestination>(TSource source)
        {
            return Mapper.Map<TSource, TDestination>(source);
        }

        public TDestination Map<TSource, TDestination>(TSource source, TDestination destination)
        {
            return Mapper.Map<TSource, TDestination>(source, destination);
        }

        public TDestination DynamicMap<TSource, TDestination>(TSource source)
        {
            return Mapper.DynamicMap<TSource, TDestination>(source);
        }
    }

}